import 'package:eye_flutter_app/provider/test.dart';
import 'package:eye_flutter_app/utils/storage.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/material.dart';

class ProviderDemo extends StatelessWidget {
  const ProviderDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var testProvider = Provider.of<TestProvider>(context);
    return Scaffold(
      appBar: AppBar(
        title: Text('provider全局状态管理'),
      ),
      body: Center(
        child: Column(
          children: [
            Text('count值：${testProvider.count}'),
            ElevatedButton(
              onPressed: () {
                testProvider.incCount();
              },
              child: Text('更新count值'),
            ),
          ],
        ),
      ),
    );
  }
}
